package com.shiroa.common;

import lombok.Data;

@Data
public class R {
    private int code;
    private String message;
    private Object data;

    private R() {
    }

    private R(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static R ok() {
        return new R(200, "成功", null);
    }

    public static R ok(Object data) {
        return new R(200, "成功", data);
    }

    public static R err(String message) {
        return new R(500, message, null);
    }

    public static R ok(int code, String message) {
        return new R(code, message, null);
    }
}
